package com.shiyi.design.iterator;

/**
 * @author wangzhanshuai
 * @date 2021/2/5 6:42 下午
 * @since 1.0
 */
public class Client {

    public static void main(String[] args) {
        ListInterface<String> list = new ArrayListImpl<>();
        list.add("1");
        list.add("2");
        list.add("3");
        list.add("4");
        IteratorInterface<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }

        ListInterface<String> linkedList = new LinkedListImpl<>();
        linkedList.add("a");
        linkedList.add("b");
        linkedList.add("c");
        linkedList.add("d");
        IteratorInterface<String> iterator1 = linkedList.iterator();
        while (iterator1.hasNext()) {
            System.out.println(iterator1.next());
        }

    }
}
